<?php
// Do not delete these lines
	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');

	if ( post_password_required() ) { ?>
		<p class="nocomments"><?php _e('This post is protected. Enter the password to view any comments.', 'dkret') ?></p>
	<?php
		return;
	}
?>

<?php if ( have_comments() ) :
$req = get_option('require_name_email'); // Checks if fields are required. Thanks, Adam. ;-)
$options=get_option('dkret3');
?>

	<h3 id="comments"><?php comments_number( __('No Responses','dkret'), __('One Response','dkret'), __('% Responses','dkret') );?></h3>
	<span class="write-comment-link"><a href="#respond" title="<?php _e('Write a Comment','dkret'); ?>"><?php if (comments_open()) { ?><?php _e('Write a Comment','dkret'); ?>&#187;<?php } ?></a></span>

	<?php paginate_comments_links() ?>
	
	<ol class="commentlist">

		<?php wp_list_comments(array(
				'style' => 'ol',
				'callback' => 'dkret_comments_callback',
				'end-callback' => 'dkret_comments_end_callback'
				)
		); ?>

	</ol>

	<?php paginate_comments_links() ?>

<?php endif ?>
	
<?php if ( 'open' == $post->comment_status ) : ?>
	<div id="respond">
		<h3><?php comment_form_title( __('Leave a Comment','dkret'), __('Leave a Comment to %s','dkret') ); ?></h3>

		<div class="cancel-comment-reply">
			<small><?php cancel_comment_reply_link( __('Click here to cancel reply.','dkret') ); ?></small>
		</div>

<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
		<p id="login-req"><?php printf(__('You must be <a href="%s" title="Log in">logged in</a> to post a comment.', 'dkret'),
			wp_login_url(get_permalink()) ) ?>
		</p>

<?php else : ?>
		<div class="formcontainer">
			<form id="commentform" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">

<?php if ( $user_ID ) : ?>
				<p id="login"><?php printf(__('<span class="loggedin">Logged in as <a href="%1$s" title="Logged in as %2$s">%2$s</a>.</span> <span class="logout"><a href="%3$s" title="Log out of this account">Log out?</a></span>', 'dkret'),
					get_option('siteurl') . '/wp-admin/profile.php',
					wp_specialchars($user_identity, true),
					wp_logout_url(get_permalink()) ) ?>
				</p>

<?php else : ?>

				<p id="comment-notes"><?php _e('Your email is never published nor shared.', 'dkret') ?></p>

				<div class="form-label"><label for="author"><?php _e('Name', 'dkret') ?></label> <?php if ($req) _e('<span class="required">(required)</span>', 'dkret') ?></div>
				<div class="form-input"><input id="author" class="required text" name="author" type="text" value="<?php echo $comment_author ?>" size="30" maxlength="20" tabindex="1" <?php if ($req) echo 'aria-required="true"'; ?>/></div>

				<div class="form-label"><label for="email"><?php _e('Email', 'dkret') ?></label> <?php if ($req) _e('<span class="required">(required)</span>', 'dkret') ?></div>
				<div class="form-input"><input id="email" class="required text" name="email" type="text" value="<?php echo $comment_author_email ?>" size="30" maxlength="50" tabindex="2" <?php if ($req) echo 'aria-required="true"'; ?>/></div>

				<div class="form-label"><label for="url"><?php _e('Website', 'dkret') ?></label></div>
				<div class="form-input"><input id="url" class="text" name="url" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="3" /></div>

<?php // Math Comment Spam Protection Plugin
if ( function_exists('math_comment_spam_protection') ) {
$mcsp_info = math_comment_spam_protection(); ?>
				<div class="form-label"><label for="mcspvalue"><?php _e('Spam Protection: Sum of','dkret'); ?> <?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' ?' ?></label> <?php if ($req) _e('<span class="required">(required)</span>', 'dkret') ?></div>
				<div class="form-input"><input id="mcspvalue" class="required text" name="mcspvalue" type="text" value="" size="30" maxlength="50" tabindex="4" <?php echo 'aria-required="true"'; ?>/></div>
				<div class="form-input"><input name="mcspinfo" type="hidden" value="<?php echo $mcsp_info['result']; ?>" /></div>
<?php } ?>
<?php endif /* if ( $user_ID ) */ ?>

				<div class="form-label"><label for="comment"><?php _e('Comment', 'dkret') ?></label></div>
				<div class="form-textarea"><textarea id="comment" class="text" name="comment" cols="45" rows="8" tabindex="5"></textarea></div>

				<div class="form-submit">
					<input id="submit" class="button" name="submit" type="submit" value="<?php _e('Post Comment', 'dkret') ?>" tabindex="6" accesskey="P" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
					<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
					<?php comment_id_fields(); ?>
				</div>

				<?php do_action('comment_form', $post->ID); ?>

			</form><!-- #commentform -->
		</div><!-- .formcontainer -->
<?php endif /* if ( get_option('comment_registration') && !$user_ID ) */ ?>

	</div><!-- #respond -->
<?php endif /* if ( 'open' == $post->comment_status ) */ ?>
